//
//  CellView.m
//  UI_06homeWork
//
//  Created by dllo on 16/5/11.
//  Copyright © 2016年 jcl. All rights reserved.
//

#import "CellView.h"

@implementation CellView

+ (instancetype)cellViewWithTitleOfName:(NSString *)titleOfName
                          titleOfNumber:(NSString *)titleOfNumber
                                  frame:(CGRect)frame
                            pictureName:(NSString *)pictureName{
    
    
    CellView *view = [[CellView alloc] initWithFrame:frame];
    
    view.label1 = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetWidth(view.bounds) / 3 + 10, 20, CGRectGetWidth(view.bounds) / 3 * 2 - 40, 40)];
    
    [view.label1 release];
    
    [view addSubview:view.label1];
    
    
    view.label2 = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetWidth(view.bounds) / 3 + 10, 120, CGRectGetWidth(view.bounds) / 3 * 2 - 40, 40)];
    
    [view addSubview:view.label2];
    
    [view.label2 release];
    
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:pictureName]];
    
    imageView.frame = CGRectMake(0, 20, CGRectGetWidth(view.bounds) / 3, CGRectGetHeight(view.bounds) - 20);
    
    
    [view addSubview:imageView];
    
    view.view = [[UIView alloc] initWithFrame:CGRectMake(0, 175, CGRectGetWidth(view.bounds), 1)];
    
    
    view.view.backgroundColor = [UIColor brownColor];
    
    [view addLabelTextitleOfName:titleOfName titleOfNumber:titleOfNumber];
    
    
    return view;
}


- (void)addLabelTextitleOfName:titleOfName titleOfNumber:titleOfNumber{
    
    self.label1.text = titleOfName;
    self.label1.textAlignment = 1;
    
    self.label2.text = titleOfNumber;
    self.label2.textAlignment = 1;
    
    
    
    
}

@end
